Skip to content
This repository was archived by the owner on Sep 4, 2020. It is now read-only.

Unregister token with firebase#2131

Closed
ccorcos wants to merge 1 commit intophonegap:masterfrom
ccorcos:master
Closed

Unregister token with firebase#2131
ccorcos wants to merge 1 commit intophonegap:masterfrom
ccorcos:master

Conversation

@ccorcos
Copy link
Copy Markdown

@ccorcos ccorcos commented Jan 4, 2018

Solves #2130

Description

Rather than disable the ability to receive notifications locally on the phone, we're actually unregistering the token with FCM.

Motivation and Context

A user logs in, we save the token for that user, the user logs out so we call unregister. A new user logs in. These two users should not be sharing the same push notification token.

How Has This Been Tested?

I used this code with my app. Logged in as a user, was able to receive notifications, called unregister on logout, attempted to send a message to that same token and received a messaging/registration-token-not-registered error message on the server and never received the message on the phone.

Types of changes

This isn't really a breaking change for the plugin, but it is logically different in terms of application code that uses this plugin. They may start to see these unregistered errors. They also can't expect to unregister and then re-init and keep the same token. But I don't imagine these are reasonable expectations.

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Copy link
Copy Markdown
Member

@macdonst macdonst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ccorcos thanks for the PR but it requires changes before it can be merged.

[pubSub unsubscribeFromTopic:topic];
}
} else {
[[UIApplication sharedApplication] unregisterForRemoteNotifications];
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ccorcos you can't delete this section as it is required for users who are using APNS to send messages. You have found an issue though and the code should check to see if usesFCM is true. If it is then you should call the deleteIDWithHandler method.

@stale
Copy link
Copy Markdown

stale bot commented Jun 3, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jun 3, 2018
@macdonst macdonst added the bug label Jun 4, 2018
@stale stale bot removed the wontfix label Jun 4, 2018
@macdonst
Copy link
Copy Markdown
Member

macdonst commented Jun 4, 2018

@macdonst a reminder to also look at Issue #2082 and this commit delphist2008@365e1a5

@macdonst
Copy link
Copy Markdown
Member

macdonst commented Aug 2, 2018

Superceeded by #2509

@macdonst macdonst closed this Aug 2, 2018
@lock
Copy link
Copy Markdown

lock bot commented Sep 1, 2018

This thread has been automatically locked.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Development

Successfully merging this pull request may close these issues.

2 participants